package cn.healthlink.proxy.demo06;

import cn.healthlink.proxy.Teacher;
import cn.healthlink.proxy.TeacherImpl;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.support.DefaultPointcutAdvisor;

/**
 * @author dengzhiyuan
 * @version 1.0
 * @time 2021/2/24 18:07
 */
public class Main {


	public static void main(String[] args) {
		Teacher teacher = new TeacherImpl();
		ProxyFactory proxyFactory = new ProxyFactory(teacher);

		MyPointcut pointcut = new MyPointcut();

		proxyFactory.addAdvisor(new DefaultPointcutAdvisor(pointcut,new MethodInterceptor01()) );
		proxyFactory.addAdvisor(new DefaultPointcutAdvisor(pointcut,new MethodInterceptor02()) );

		Teacher teacher2 = (Teacher) proxyFactory.getProxy();

		teacher2.sayHello("dzy");
		teacher2.work();


	}

}
